<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function Hero(uname, utype, ublood) {
            this.name = uname;
            this.type = utype;
            this.blood = ublood;
            this.atta = function (gongji) {
                console.log(gongji);
            }
        }
        var lianbo = new Hero('廉颇', '力量型', '500血量',);
        console.log(lianbo.name, lianbo.type, lianbo.blood);
        lianbo.atta('近战');
        var houyi = new Hero('后羿', '射手型', '100血量',);
        console.log(houyi.name, houyi.type, houyi.blood);
        houyi.atta('远程');
    </script>
</head>

<body>

</body>

</html>